<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->

<head>
<meta charset="utf-8">
<title>SMM撮合系统</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="" name="description">
<meta content="" name="author">
<link href="${request.getContextPath()}/Public/assets/admin/css/css.css"
	rel="stylesheet" type="text/css">
<link
	href="${request.getContextPath()}/Public/assets/global/plugins/font-awesome/css/font-awesome.min.css"
	rel="stylesheet" type="text/css">
<link
	href="${request.getContextPath()}/Public/assets/global/plugins/simple-line-icons/simple-line-icons.min.css"
	rel="stylesheet" type="text/css">
<link
	href="${request.getContextPath()}/Public/assets/global/plugins/bootstrap/css/bootstrap.min.css"
	rel="stylesheet" type="text/css">
<link
	href="${request.getContextPath()}/Public/assets/global/plugins/uniform/css/uniform.default.css"
	rel="stylesheet" type="text/css">
<link
	href="${request.getContextPath()}/Public/assets/global/css/components-rounded.css"
	id="style_components" rel="stylesheet" type="text/css">
<link
	href="${request.getContextPath()}/Public/assets/global/css/plugins.css"
	rel="stylesheet" type="text/css">
<link
	href="${request.getContextPath()}/Public/assets/admin/css/layout.css"
	rel="stylesheet" type="text/css">
<link
	href="${request.getContextPath()}/Public/assets/admin/css/themes/default.css"
	rel="stylesheet" type="text/css" id="style_color">
<link
	href="${request.getContextPath()}/Public/assets/admin/css/custom.css"
	rel="stylesheet" type="text/css">
<link
	href="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css"
	rel="stylesheet" type="text/css">
<link
	href="${request.getContextPath()}/Public/assets/admin/css/common.css"
	rel="stylesheet" type="text/css">
<link rel="shortcut icon"
	href="${request.getContextPath()}/Public/favicon.ico">
<!--[if lt IE 9]>
<script src="${request.getContextPath()}/Public/assets/global/plugins/respond.min.js"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/excanvas.min.js"></script>
<![endif]-->
<script
	src="${request.getContextPath()}/Public/assets/global/plugins/jquery.min.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/global/plugins/jquery-migrate.min.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/global/plugins/jquery-ui/jquery-ui.min.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap/js/bootstrap.min.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/global/plugins/jquery.blockui.min.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/global/plugins/jquery.cokie.min.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/global/plugins/uniform/jquery.uniform.min.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/global/plugins/jquery.sparkline.min.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/global/scripts/metronic.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/admin/scripts/layout.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/admin/scripts/indexComponent.js"
	type="text/javascript"></script>
<script
	src="${request.getContextPath()}/Public/assets/admin/scripts/commonUtils.js"
	type="text/javascript"></script>
<script>
	BASE_URL = '${request.getContextPath()}'
</script>
</head>
<body class="page-header-top-fixed">
	<div class="page-header">
		<!--头部开始-->
		<#include "/include/top.html" />
		<!-- 头部信息结束 -->

		<!-- 头部菜单开始 -->
		<#include "/include/top_menu.html" />
		<!-- 头部菜单结束 -->
	</div>
	<!-- END HEADER -->


	<!-- BEGIN PAGE CONTAINER -->
	<!-- 头部结束 -->
	<div class="page-container">
		<!-- 内容开始 -->
		<div class="page-content">
			<div class="container-fluid">
				<!-- 当前位置提示开始 -->
				<ul class="page-breadcrumb breadcrumb">
					<li>
						<a href="#">首页</a><i class="fa fa-circle"></i>
					</li>
					<li class="active">
						 商品管理<i class="fa fa-circle"></i>
					</li>
					<li class="active">
						 添加属性
					</li>
				</ul>
			<!-- 当前位置提示结束 -->
				<div class="row margin-top-10">
					<div class="col-md-12">
						<div class="portlet light bordered">
							<div>
								<p style="font-size: 28px; font-weight: bold;">
									添加属性<span style="font-size: 18px;">&nbsp;类别：${Session["userInfo"].items.name}</span>
								</p>
							</div>
							<div class="portlet-body">
								<form id="dataForm">
									<table class="tb" border="0">
										<tr>
											<td style="text-align: right;">属性名称:</td>
											<td>&nbsp;<input type="text" name="name" id="name"></td>
										</tr>
										<tr>
											<td style="text-align: right;">填写方式:</td>
											<td id="selectContent">&nbsp; 
											
												<select name="fillmode" id="fillmode">
														<option value="0">输入框</option>
														<option value="1">下拉框</option>
														<option value="2">复选框</option>
														<option value="3">单选框</option>
												</select> 
												
												<div id="dataregural" style="display: inline;"> 
													<select name="dataregural">
																<option value="0">数值</option>
																<option value="1">英文</option>
																<option value="2">文本</option>
																<option value="3">英文+数值</option>
																<option value="4">自然数</option>
													</select> 默认值:<input type="text" name="defaulta">
												</div> 
											    <input type="hidden" name="options" id="optionsid" value="">
											</td>
										</tr>
										<tr>
											<td style="text-align: right;">是否必填:</td>
											<td>&nbsp;<input value="1" type="checkbox"
												name="required" /></td>
										</tr>
										<tr>
											<td style="text-align: right;">是否是主要属性:</td>
											<td>&nbsp;<input value="1" type="checkbox"
												name="mainproperty"></td>
										</tr>
									</table>
								</form>
								<div style="width: 50%; text-align: center; margin-top: 50px;">
									<a class="btn green" onclick="save()"> <i
										class="fa fa-save"></i> 保存
									</a>
								</div>
								<br> <br>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- END PAGE CONTAINER -->


	<!-- 底部开始 -->
	<#include "/include/foot.html" />
	<!-- 底部结束 -->
</body>
<script>
	jQuery(document).ready(function() {
		Metronic.init(); // init metronic core componets
		Layout.init(); // init layout
	});
	var   dataregural=$("#dataregural").html();
	function addText() {
			var a = '<input type="text" name="option"/> <label> <input type="radio" name="optionRadio"></label>';
			$("#add").append(a);
			Metronic.init(); // init metronic core componets
			Layout.init(); // init layout
	}

	$(function() {
		$("#fillmode").change(function() {
			var count = $(this).val();
			if (count != 0) {
				var aa=	'<input type="text" name="option"/><label><input type="radio"  name="optionRadio"/></label><input type="text" name="option"/><label id="add" ><input type="radio"  name="optionRadio" /></label> <i class="fa fa-plus-circle" style="cursor: pointer;"onclick="addText()"></i>';
				$("#dataregural").html(aa);
				Metronic.init(); // init metronic core componets
				Layout.init(); // init layout
			} else {
				$("#dataregural").html(dataregural);
			}
		});

	});

	function save() {
		if ($("#name").val() == "" || $("#name").val() == null) {
			return CommonUtils.succModal("系统提示", "属性名字不能为空");
		}
		var options = "";
		if ($('#fillmode').val() != 0) {
			var arrayObj = new Array();
			$('input[name="option"]').each(function() {
				if ($(this).val() != null && $(this).val() != "") {
					arrayObj[arrayObj.length] = $(this).val();
				}
			});
			options = arrayObj.join(",");
		}
		$("#optionsid").val(options);
		$.ajax({
			url : "${request.getContextPath()}/itemattr/itemattrAdd.do",
			type : "post",
			dataType : "json",
			async : false,
			data : $("#dataForm").serialize(),
			success : function(result) {
				debugger;
				CommonUtils.succModal2("系统提示", result.message, document.referrer);
			},
			error : function(aa) {
				CommonUtils.succModal("系统提示", "网络异常:"+aa.message);
			}
		});
	}
</script>
</html>

